<template>
  <a-carousel arrows autoplay>
    <div
      slot="prevArrow"
      class="custom-slick-arrow"
      style="left: 10px;zIndex: 1"
    >
      <a-icon type="left-circle" />
    </div>
    <div slot="nextArrow" class="custom-slick-arrow" style="right: 10px">
      <a-icon type="right-circle" />
    </div>
    <div v-for="item in CarouselList" :key="item.id">
        <div class="img" v-if="CarouselList.length>0" :style="`background:url(${item.s_photos[0].path}) no-repeat -500px 0/cover`"></div>
    </div>
    <!-- <img v-for="item in CarouselList" :key="item.id" :src="item.s_photos[0].path" alt=""> -->
  </a-carousel>
</template>
<script>
import {getCarousel} from '../assets/js/request'
export default {
    data() {
        return {
            CarouselList:[],
        }
    },
    async created() {
        // 获取轮播图
        let carousel = await getCarousel("index");
        console.log(carousel);
        let a = carousel.filter((ele,index)=>{
            if(index<4) {
                return ele
            }
        })
        this.CarouselList = a

    }
};
</script>
<style scoped>
/* For demo */
.ant-carousel >>> .slick-slide {
  text-align: center;
  height: 480px;
  background: #364d79;
  overflow: hidden;
}

.ant-carousel >>> .custom-slick-arrow {
  width: 25px;
  height: 25px;
  font-size: 25px;
  color: #fff;
  background-color: rgba(31, 45, 61, 0.11);
  opacity: 0.3;
}
.ant-carousel >>> .custom-slick-arrow:before {
  display: none;
}
.ant-carousel >>> .custom-slick-arrow:hover {
  opacity: 0.5;
}

.ant-carousel >>> .slick-slide .img {
  /* color: #fff; */
  height: 480px;
}
</style>
